﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SuperFind.Lib.Core;
using System.IO;
using System.Drawing;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Drawing.Imaging;

namespace SuperFind.Lib.Core
{
	public static class ExtentionMethods
	{
		public static BitmapFrame ConvertFromIcon(this ImageSourceConverter imageSourceConverter, Icon icon)
		{
            MemoryStream iconStream = new MemoryStream();
            icon.Save(iconStream);
            iconStream.Seek(0, SeekOrigin.Begin);
            IconBitmapDecoder decoder = new IconBitmapDecoder(iconStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
            ImageConverter imgConverter = new ImageConverter();
            return decoder.Frames[0];
		}
	}
}
